<div class="row">
	<div class="col-md-12">
		<h1>Liên hệ <small>Danh sách liên hệ</small></h1>
		<ol class="breadcrumb">
            <li><a href="<?php echo mns_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li class="active"><i class="fa fa-table"></i> Các liên hệ hiện có</li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <?php
            $status = -1;
            $title = '';
            $text = '';
            if(isset($message)){
                $title = isset($message['title'])?$message['title']:'';
                $text = isset($message['text'])?$message['text']:'';
                $status = isset($message['code'])?$message['code']:'';
            }
        ?>
        <div id="flg_message" class="alert alert-<?php echo $status==0?'danger':'success' ?> fade in <?php echo $status==-1?'hidden':''; ?>">
            <button type="button" class="close">×</button>
            <h4 class="message-title"><?php echo $title; ?></h4>
            <div class="message-text"><?php echo $text; ?></div>
        </div>
    </div>

    <div class="col-md-12">
        <div class="pull-right"><?php echo $pagingBar; ?></div>
    </div>
    <div class="clearfix"></div>
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table table-bordered table-hover tablesorter item-list" data-href="<?php echo mns_page_url(CONTACT_SLUG.'/thay-doi'); ?>">
                <thead>
                    <tr>
                        <th class="header"># <i class="fa fa-sort"></i></th>
                        <th class="header">Người liên hệ <i class="fa fa-sort"></i></th>
                        <th class="header">Tiêu đề <i class="fa fa-sort"></i></th>
                        <th class="header">Ngày tạo <i class="fa fa-sort"></i></th>
                        <th class="header">Chưa đọc</th>
                        <th class="header">Xoá</th>
                        <th class="header">Chi tiết </th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($aContact as $index=>$tContact) { ?>
                    <?php $unreadClass = $tContact->getUnread()==1?"unread":''; ?>
                    <tr class="can-edit" id="row<?php echo $index; ?>" data-id="<?php echo $this->encrypt->encode($tContact->getId()); ?>">
                        <th class="header bg-info"><?php echo $index+1; ?></th>
                        <td>
                            <span class="<?php echo $unreadClass ?>"><?php echo $tContact->getName(); ?></span>
                        </td>
                        <td>
                            <span class="<?php echo $unreadClass ?>"><?php echo $tContact->getSubject(); ?></span>
                            <br />
                            <small><?php echo substr($tContact->getMessage(), 0, 100); ?> ...</small>
                        </td>
                        <td><?php echo fdate_format($tContact->getCreatedAt(), 'd/m/Y'); ?></td>
                        <td>
                            <input class="checkbox input-contact-unread" data-index="<?php echo $index; ?>" id="chk<?php echo $index; ?>" data-name="unread" type="checkbox" <?php echo $tContact->getUnread()==1?"checked='checked'":''; ?> />
                        </td>
                        <td>
                            <input class="checkbox input-contact-delete-flg" data-index="<?php echo $index; ?>" data-name="delete_flg" type="checkbox" <?php echo $tContact->getDeletedAt()!=NULL?"checked='checked'":''; ?> />
                        </td>
                        <td>
                            <a class="btn btn-success btn-contact-read" data-index="<?php echo $index; ?>" href="<?php echo mns_page_url('lien-he-'.$tContact->getId()); ?>">
                                <i class="fa fa-bars"></i> Chi tiết
                            </a>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="clearfix"></div>
</div>